package com.yang.usb;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatButton;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private AppCompatButton btnusbserial, usbaoahost, usbaoaAccessory;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btnusbserial = findViewById(R.id.usbserial);
        btnusbserial.setOnClickListener(this);
        usbaoahost = findViewById(R.id.usbaoahost);
        usbaoahost.setOnClickListener(this);
        usbaoaAccessory = findViewById(R.id.usbaoaAccessory);
        usbaoaAccessory.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.usbserial) {
            startActivity(new Intent(this, UsbserialActivity.class));
        } else if (id == R.id.usbaoahost) {
            startActivity(new Intent(this, UsbhostaoaActivity.class));
        } else if (id == R.id.usbaoaAccessory) {
            startActivity(new Intent(this, UsbaccessoryaoaActivity.class));
        }
    }
}